﻿#include "../goods/goods.h"
#include "../main/main.h"
//using namespace std;
goods::goods() {
    name = "";
    item_number = -1;
    price = 0;
    number = 0;
}
goods::goods(class manager& m) {
    // 从管理员那里获取商品信息
    cout << "请输入商品信息:" << endl;
    cout << "名称:";
    cin >> name;
    do {
        cout << "编号：";
        cin >> item_number;
        if (item_number <= 0) {
            cout << "编号不能为0和负，请重新输入" << endl;
        }
    } while (item_number <= 0);
    do {
        cout << "价格:";
        cin >> price;
        if (price <= 0) {
            cout << "价格不能为0和负，请重新输入" << endl;
        }
    } while (price <= 0);
    do {
        cout << "数量:";
        cin >> number;
        if (number <= 0) {
            cout << "数量不能为0和负，请重新输入" << endl;
        }
    } while (number <= 0);
}
goods::goods(class cashier& c) {
    // 从管理员那里获取商品信息
    cout << "请输入商品信息:" << endl;
    cout << "名称:";
    cin >> name;
    do {
        cout << "编号：";
        cin >> item_number;
        if (item_number <= 0) {
            cout << "编号不能为0和负，请重新输入" << endl;
        }
    } while (item_number <= 0);
    do {
        cout << "价格:";
        cin >> price;
        if (price <= 0) {
            cout << "价格不能为0和负，请重新输入" << endl;
        }
    } while (price <= 0);
    do {
        cout << "数量:";
        cin >> number;
        if (number <= 0) {
            cout << "数量不能为0和负，请重新输入" << endl;
        }
    } while (number <= 0);
}